<h2>Cat&eacute;gories - Option</h2>

<div id="ajax-response">
<?php 
if(isset($_SESSION['notification'])){
	echo implode(' <br/> ',$_SESSION['notification']);
	unset($_SESSION['notification']);
}
?>
</div>

<form class="search-form" method="post" accept-charset="utf-8" action="">
<p class="search-box">
  <input name="search_option" value="<?php echo isset($_POST['search_option'])?$_POST['search_option']:''?>"  type="text"/>
	<input value="Rechercher Option" type="submit">
</p>
</form>
<br class="clear">

<div id="col-container">

<div id="col-right">
<div class="col-wrap">
<form id="posts-filter" method="post" accept-charset="utf-8" action="">
<table  class="wp-list-table widefat fixed tags">
	<thead>
		<tr>
			<th class="manage-column column-name_type sortable desc" id="name_type" scope="col">
				<a href="#name_type"><span>Nom Option</span><span class="sorting-indicator"></span></a>
			</th>
			<th class="manage-column column-type sortable desc" id="type" scope="col">
				<a href="#type"><span>Type</span><span class="sorting-indicator"></span></a>
			</th>
			<th class="manage-column column-value sortable desc" id="value" scope="col">
				<a href="#value"><span>Valeur par default</span><span class="sorting-indicator"></span></a>
			</th>
			<th class="manage-column column-unity sortable desc" id="unity" scope="col">
				<a href="#value"><span>Unité</span><span class="sorting-indicator"></span></a>
			</th>
		</tr>
	</thead>

	<tfoot>
		<tr>
			<th class="manage-column column-name_type sortable desc" id="name_type" scope="col">
				<a href="#name_type"><span>Nom Option</span><span class="sorting-indicator"></span></a>
			</th>
			<th class="manage-column column-type sortable desc" id="type" scope="col">
				<a href="#type"><span>Type</span><span class="sorting-indicator"></span></a>
			</th>
			<th class="manage-column column-value sortable desc" id="value" scope="col">
				<a href="#value"><span>Valeur par default</span><span class="sorting-indicator"></span></a>
			</th>
			<th class="manage-column column-unity sortable desc" id="unity" scope="col">
				<a href="#value"><span>Unité</span><span class="sorting-indicator"></span></a>
			</th>
		</tr>
	</tfoot>

	<tbody data-wp-lists="list:tag" id="the-list">
	<?php 
	foreach($tableOptionBody as $row){
	
		$id=$row->id_type;
		$valueDefault=$row->value;
		if($row->type=='select'){
			
			$valueDefault='
					<select>';
			if(is_array($expValue=explode(',',$row->value)))
				foreach ($expValue as $val)$valueDefault.="<option>$val</option>";
			$valueDefault.="</select>
				";
		}
			echo "
		<tr class='alternate' id='option-$id'>
			<td class='name column-name'><strong class='row-title'id='option$id'>{$row->name}</strong><br>
				<div class='row-actions'>
					<span class='inline editinlineOption'> Edition rapide  | </span>
					<span class='delete'><a href='setting/option/delete/$id' class='delete-tag'>Supprimer</a> </span>
				</div>
				<div id='inline_$id' class='hidden'>
					<div class='name'>{$row->name}</div>
					<div class='type'>{$row->type}</div>
					<div class='value'>{$row->value}</div>
				</div>
			</td>
			<td class='slug column-slug'>{$row->type}</td>
			<td class='description column-description'>{$valueDefault}</td>
			<td class='description column-description'>{$row->unit}</td>
		</tr>";
		}
	?>
	</tbody>
</table>
<br class="clear">
</form>

<div class="form-wrap">
<p><strong>Note:</strong><br>
  Supprimer une cat&eacute;gorie ne supprime pas les m&eacute;ssages pr&eacute;sent dans celle ci.
Cependant les messages qui ont &eacute;t&eacute; affect&eacute;s sont mis dans la cat&eacute;gorie <strong>Non class&eacute;</strong>.</p>
<p>Les cat&eacute;gories selectionn&eacute;es peuvent etre converti en utilisant des balises pour <a href="import.php">marquer la cat&eacute;gorie</a>.</p>
</div>

</div>
</div><!-- /col-right -->

<div id="col-left">
<div class="col-wrap">


<div class="form-wrap"><input type="submit" value="Ajouter Nouvelle Option" class="button button-primary" id="submit" name="Add_Options">
<form class="validate" action="" method="post" id="addtag">
<div class="form-field form-required">
	<label for="tag-name"><br />
	  Nom de l'option:</label>
	<input type="text" aria-required="true" size="40" value="" id="tag-name" name="name">
</div>

<div class="form-field">
	<label for="type">Type :</label>
	<select class="postform" id="type" name="type">
		<option value="input">Champs &agrave; saisir</option>
		<option value="select">Liste d&eacute;roulant</option>
	</select>
			<p>Champs à saisir : Ce type va creer un champ de texte ou l'utilisateur rentre une valeur.<br />
			  Liste déroulante : 
			Ce type creer un menu déroulant avec les différentes valeur.</p>
</div>

<div class="form-field">
	<label for="type">Parent :</label>
	<select class="postform" name="parent">
		<option value="0">aucune</option>
		<?php echo $optionParent?>
	</select>
</div>
<div class="form-field">
	<label for="tag-value">Valeur par defaut :</label>
	<textarea cols="40" rows="5" id="tag-value" name="value"></textarea>
</div>

<div class="form-field">
	<label for="tag-unit">Unité :</label>
	<input type="text" aria-required="true" size="40" value="" id="tag-unit" name="unit">
	<br />
	Exemple : pièce,m²,etc....</div>
<p class="submit"><input type="submit" value="Ajouter Nouvelle Option" class="button button-primary" id="submit" name="Add_Options"></p></form></div>

</div>
</div><!-- /col-left -->

</div><!-- /col-container -->
</div><!-- /wrap -->
<script type="text/javascript">
try{document.forms.addtag['tag-name'].focus();}catch(e){}
</script>

	<table style="display: none">
	<tbody id="inlineedit">
		<tr style="display: none" class="inline-edit-row" id="inline-edit">
		<td class="colspanchange" colspan="5">

		<form action="" method="post">
			<fieldset>
			<div class="inline-edit-col">
				<h4>Edition Rapide</h4>

				<label>
					<span class="title">Nom</span>
					<span class="input-text-wrap">
					<input id="tag-name" type="text" value="" class="ptitle" name="name" /></span>
				</label>
				<p class="clear"/>
				<label>
					<span class="title">Type</span>
					<span class="input-text-wrap">
					<select class="postform" name="type">
						<option value="input">Champs à saisir</option>
						<option value="select">Liste déroulant</option>
					</select>
					</span>
				</label>
				<label>
					<span class="title">parent</span>
					<span class="input-text-wrap">
					<select class="postform" name="parent">
						<option value="0">aucune</option>
						<?php echo $optionParent?>
					</select>
					</span>
				</label>
				<p class="clear"/>
				<label>
					<span class="title">Value</span>
					<span class="input-text-wrap">					
					<textarea cols="20" rows="1" name="value"></textarea></span>
				</label>
				
				<label>
					<span class="title">Unité</span>
					<span class="input-text-wrap">
					<input id="tag-unit" type="text" value="" class="ptitle" name="unit" /></span>
				</label>
			</div>
			</fieldset>
	
		<p class="inline-edit-save submit">
			<button class="cancel button-secondary alignleft" title="Cancel" accesskey="c">Annuler</button>
			<button class="save button-primary alignright" name="Update_Options"  value="Update_Category" type="submit" accesskey="s">Mise à jour l'Option</button>
			<span class="spinner"></span>
			<input type="hidden" value="" name="id">
			<br class="clear"/>
		</p>
		</form>
		</td>
		</tr>
		</tbody></table>
	

<div class="clear"></div>